from  models import *
from django.shortcuts import render_to_response
from django.template import RequestContext
# Create your views here.

def blogpage(request):
	
       	posts = Post.objects.all().order_by("-created")
       	sites = Sites.objects.all()
       	myskill = MySkills.objects.all()
       	categories = Category.objects.all()
       	return render_to_response("index.html" , locals())
        
	
def AboutMe(request):
	
	sites = Sites.objects.all()
	myskill = MySkills.objects.all()
	categories = Category.objects.all()
	return render_to_response("aboutme.html" , locals())
	
def CPosts(request):
        
        if request.method=="POST":
		name = request.POST.get('name' , '')
		cposts = Post.objects.get(category = name)
		return render_to_response("category.html" , locals())
        else:
		return render_to_response("index.html" , RequestContext(request))